/**
 * Created by Administrator on 2019/7/31.
 */

'use strict';
const wxdecrypt = require('yi-wx-encryp');

const  middleware = (req,res,next)=>{
    next();
};

const handler = (req,res,next)=>{
    let doc = req.body;
    wxdecrypt.decryptData(req.config.miniprogram.appid, doc.sessionKey, doc.encryptedData,doc.iv,(e,r)=>{
        res.reply({code:0,message:'解密成功！',data:r});
    });
};

module.exports={
    description: '微信解密获取手机号',
    middleware:middleware,
    handler:handler
};

